package com.song.qqonline;

import java.util.ArrayList;
import java.util.List;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import android.util.Log;

public class WebServiceUtil
{
	// 定义Web Service的命名空�?
	static final String SERVICE_NS = "http://WebXml.com.cn/";
	// 定义Web Service提供服务的URL
	static final String SERVICE_URL = "http://fy.webxml.com.cn/webservices/EnglishChinese.asmx";
	                                   
	
	public static String getQQstatus(String qq){
		
		String methodName = "qqCheckOnline";
		// 创建HttpTransportSE传输对象
		HttpTransportSE httpTranstation = new HttpTransportSE(SERVICE_URL);

		httpTranstation.debug = true;
		// 使用SOAP1.1协议创建Envelop对象
		SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
				SoapEnvelope.VER11);
		// 实例化SoapObject对象
		SoapObject soapObject = new SoapObject(SERVICE_NS, methodName);
		soapObject.addProperty("qqCode", qq);
		envelope.bodyOut = soapObject;
		// 设置�?Net提供的Web Service保持较好的兼容�?
		envelope.dotNet = true;
		try
		{
			// 调用Web Service
			httpTranstation.call(SERVICE_NS + methodName, envelope);
			if (envelope.getResponse() != null)
			{
				Object object = (Object)envelope.getResponse();
				return object.toString();
			}
		} catch (Exception e)
		{
			e.printStackTrace();
			Log.e("getQQstatus", "e="+e.getMessage());
		}

		return null;
	
	}

	

}
